<script setup>
import { useUserStore } from '@/stores'
const {
  user: { name, username, idCard, phone, image, sexs, balance }
} = useUserStore()
</script>
<template>
  <div class="home-overview">
    <!-- 用户信息 -->
    <div class="user-meta">
      <div class="avatar">
        <img v-if="image" :src="image" />
        <img v-else src="@/assets/avatar.png" />
      </div>
      <h4>{{ name }}</h4>
    </div>
    <div class="item">
      <span class="bal">
        <span class="iconfont icon-hy"></span>
        <p>余额:{{ balance }}元</p>
      </span>
    </div>
  </div>
  <div class="like-container">
    <div class="home-panel">
      <div class="header">
        <h4 data-v-bcb266e0="">用户信息</h4>
      </div>
      <div class="goods-list">
        <table class="goods">
          <thead>
            <tr>
              <th width="170">名称</th>
              <th width="170">用户名</th>
              <th width="170">学号</th>
              <th width="170">性别</th>
              <th width="170">余额</th>
              <th width="170">电话</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>{{ name }}</td>
              <td>{{ username }}</td>
              <td>{{ idCard }}</td>
              <td>
                {{ sexs }}
              </td>
              <td>{{ balance }}</td>
              <td>{{ phone }}</td>
            </tr>
          </tbody>
        </table>
      </div>
    </div>
  </div>
</template>
<style>
.home-overview {
  height: 132px;
  background: url(@/assets/login_bg.jpg) no-repeat center / cover;
  display: flex;
  .user-meta {
    flex: 1;
    display: flex;
    align-items: center;
    .avatar {
      width: 85px;
      height: 85px;
      border-radius: 50%;
      overflow: hidden;
      margin-left: 60px;

      img {
        width: 100%;
        height: 100%;
      }
    }
    h4 {
      padding-left: 26px;
      font-size: 18px;
      font-weight: normal;
      color: white;
    }
  }
  .item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-around;

    &:first-child {
      border-right: 1px solid #f4f4f4;
    }
    .bal {
      color: white;
      font-size: 16px;
      text-align: center;

      .iconfont {
        font-size: 32px;
      }
      p {
        line-height: 32px;
      }
    }
  }
}
.like-container {
  margin-top: 20px;
  border-radius: 4px;
  opacity: 0.7;
}
.home-panel {
  padding: 0 20px;
  margin-top: 20px;
  height: 400px;
  .header {
    height: 66px;
    border-bottom: 1px solid #f5f5f5;
    padding: 18px 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    h4 {
      font-size: 22px;
      font-weight: 400;
    }
  }
  .goods-list {
    display: flex;
    justify-content: space-around;
    .goods {
      width: 100%;
      border-collapse: collapse;
      border-spacing: 0;

      .info {
        display: flex;
        text-align: left;

        .im {
          width: 70px;
          height: 70px;
          margin-right: 20px;
        }

        .right {
          line-height: 24px;

          p {
            &:last-child {
              color: #999;
            }
          }
        }
      }

      tr {
        th {
          background: #f5f5f5;
          font-weight: normal;
        }

        td,
        th {
          text-align: center;
          padding: 20px;
          border-bottom: 1px solid #f5f5f5;

          &:first-child {
            border-left: 1px solid #f5f5f5;
          }

          &:last-child {
            border-right: 1px solid #f5f5f5;
          }
        }
      }
    }
  }
}
</style>
